placessidebar: escape tooltip text before setting it
authorCosimo Cecchi <cosimoc@gnome.org>
Sat, 23 May 2015 23:14:39 +0000 (16:14 -0700)
committerCosimo Cecchi <cosimoc@gnome.org>
Sun, 24 May 2015 19:04:22 +0000 (12:04 -0700)
gtk_tree_view_set_tooltip_column() specifies that markup in the text
should be escaped.
This fixes critical warnings when hovering over items in the sidebar for
bookmarks that have markup characters in their names.

https://bugzilla.gnome.org/show_bug.cgi?id=719683

gtk/gtkplacessidebar.c

index a5bc74b1b73adaca0e3d8bacd692a0c25eade4e6..41ec9acd4ae83fac12353942df7a0d17a468b245 100644 (file)
@@ -496,6 +496,7 @@ add_place (GtkPlacesSidebar *sidebar,
   GtkTreeIter iter;
   gboolean show_eject, show_unmount;
   gboolean show_eject_button;
+  gchar *tooltip_escaped;
 
   check_heading_for_section (sidebar, section_type);
 
@@ -510,6 +511,8 @@ add_place (GtkPlacesSidebar *sidebar,
   else
     show_eject_button = (show_unmount || show_eject);
 
+  tooltip_escaped = g_markup_escape_text (tooltip, -1);
+
   gtk_list_store_append (sidebar->store, &iter);
   gtk_list_store_set (sidebar->store, &iter,
                       PLACES_SIDEBAR_COLUMN_GICON, icon,
@@ -523,9 +526,11 @@ add_place (GtkPlacesSidebar *sidebar,
                       PLACES_SIDEBAR_COLUMN_EJECT, show_eject_button,
                       PLACES_SIDEBAR_COLUMN_NO_EJECT, !show_eject_button,
                       PLACES_SIDEBAR_COLUMN_BOOKMARK, place_type != PLACES_BOOKMARK,
-                      PLACES_SIDEBAR_COLUMN_TOOLTIP, tooltip,
+                      PLACES_SIDEBAR_COLUMN_TOOLTIP, tooltip_escaped,
                       PLACES_SIDEBAR_COLUMN_SECTION_TYPE, section_type,
                       -1);
+
+  g_free (tooltip_escaped);
 }
 
 static GIcon *